package com.taobao.api.request;

import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.HanoiAttributesGetResponse;

/**
 * TOP API: taobao.hanoi.attributes.get request
 * 
 * @author auto create
 * @since 1.0, 2013-08-03 16:51:00
 */
public class HanoiAttributesGetRequest implements TaobaoRequest<HanoiAttributesGetResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 属性编码
   */
  private String              code;

  /**
   * 分页时需要用。默认第一页。
   */
  private Long                currentPage;

  /**
   * 属性的唯一标识
   */
  private Long                id;

  /**
   * 是否支持模糊查询
   */
  private Boolean             indistinctQuery;

  /**
   * 分页时 每页显示的条数。最小1 最大30 默认10页
   */
  private Long                pageSize;

  /**
   * 属性名称
   */
  private String              title;

  /**
   * Top 的访问权限。按位与。1：可读，2：可写，4：可规则计算。如可读且可写的权限值为3。
   */
  private Long                topAccess;

  /**
   * 类型 唯一标识
   */
  private Long                typeId;

  /**
   * 类型名称
   */
  private String              typeName;

  public void setCode(String code) {
    this.code = code;
  }

  public String getCode() {
    return this.code;
  }

  public void setCurrentPage(Long currentPage) {
    this.currentPage = currentPage;
  }

  public Long getCurrentPage() {
    return this.currentPage;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Long getId() {
    return this.id;
  }

  public void setIndistinctQuery(Boolean indistinctQuery) {
    this.indistinctQuery = indistinctQuery;
  }

  public Boolean getIndistinctQuery() {
    return this.indistinctQuery;
  }

  public void setPageSize(Long pageSize) {
    this.pageSize = pageSize;
  }

  public Long getPageSize() {
    return this.pageSize;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getTitle() {
    return this.title;
  }

  public void setTopAccess(Long topAccess) {
    this.topAccess = topAccess;
  }

  public Long getTopAccess() {
    return this.topAccess;
  }

  public void setTypeId(Long typeId) {
    this.typeId = typeId;
  }

  public Long getTypeId() {
    return this.typeId;
  }

  public void setTypeName(String typeName) {
    this.typeName = typeName;
  }

  public String getTypeName() {
    return this.typeName;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.hanoi.attributes.get";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("code", this.code);
    txtParams.put("current_page", this.currentPage);
    txtParams.put("id", this.id);
    txtParams.put("indistinct_query", this.indistinctQuery);
    txtParams.put("page_size", this.pageSize);
    txtParams.put("title", this.title);
    txtParams.put("top_access", this.topAccess);
    txtParams.put("type_id", this.typeId);
    txtParams.put("type_name", this.typeName);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<HanoiAttributesGetResponse> getResponseClass() {
    return HanoiAttributesGetResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkMaxLength(code, 50, "code");
    RequestCheckUtils.checkMaxValue(currentPage, 2147483647L, "currentPage");
    RequestCheckUtils.checkMinValue(currentPage, 1L, "currentPage");
    RequestCheckUtils.checkMaxValue(id, 9223372036854775807L, "id");
    RequestCheckUtils.checkMinValue(id, 1L, "id");
    RequestCheckUtils.checkMaxValue(pageSize, 30L, "pageSize");
    RequestCheckUtils.checkMinValue(pageSize, 1L, "pageSize");
    RequestCheckUtils.checkMaxLength(title, 50, "title");
    RequestCheckUtils.checkMaxValue(topAccess, 7L, "topAccess");
    RequestCheckUtils.checkMinValue(topAccess, 0L, "topAccess");
    RequestCheckUtils.checkMaxValue(typeId, 9223372036854775807L, "typeId");
    RequestCheckUtils.checkMinValue(typeId, 1L, "typeId");
    RequestCheckUtils.checkMaxLength(typeName, 50, "typeName");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
